//
//  ShopAddressTableViewCell.m
//  jianpai
//
//  Created by yrapp on 16/1/14.
//  Copyright © 2016年 yrapp. All rights reserved.
//

#import "ShopAddressTableViewCell.h"

@implementation ShopAddressTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
 
        
        UIImageView *backImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kWidth, 80)];
        backImageView.image = [UIImage imageNamed:@"addressBackground.jpg"];
        [self.contentView addSubview:backImageView];
        
        
        //头像图标
        self.nameImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, 12.5, 15, 15)];
        self.nameImage.image = [UIImage imageNamed:@"icon_jiesuan_nane"];
        [self.contentView addSubview:self.nameImage];

        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(30, 10, kWidth/2 - 20, 20)];
        _nameLabel.font = [UIFont systemFontOfSize:15];
       // _nameLabel.text = @"姓名:张三";
        _nameLabel.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:_nameLabel];
        
        
        
        //手机图标
        self.phoneImage = [[UIImageView alloc] initWithFrame:CGRectMake(kWidth / 2 - 20, 12.5, 15, 15)];
        self.phoneImage.image = [UIImage imageNamed:@"icon_jiesuan_shouji"];
        [self.contentView addSubview:self.phoneImage];
        
        _phoneLabel = [[UILabel alloc] initWithFrame:CGRectMake(kWidth / 2, 10, kWidth - 20, 20)];
        _phoneLabel.font = [UIFont systemFontOfSize:15];
       // _phoneLabel.text = @"手机:18055694257";
        _nameLabel.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:_phoneLabel];
        
        _addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 35, kWidth - 40, 40)];
        _addressLabel.font = [UIFont systemFontOfSize:13];
        //_addressLabel.text = @"浙江省杭州市西湖区西溪街道浙大科技园A楼西区620";
        _addressLabel.textAlignment = NSTextAlignmentLeft;
        _addressLabel.numberOfLines = 0;
        [self.contentView addSubview:_addressLabel];
        
        //未设置地址
        _noAddress = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, kWidth, 30)];
        _noAddress.font = [UIFont systemFontOfSize:16];
        _noAddress.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:_noAddress];
        
    }
    
    return self;
    
}

- (void)setModel:(ShopAddressModel *)model {
    
    _nameLabel.text = [NSString stringWithFormat:@"%@",model.truename];
    _phoneLabel.text = [NSString stringWithFormat:@"%@",model.mobile];
    _addressLabel.text = [NSString stringWithFormat:@"%@%@%@%@",model.sheng,model.shi,model.xian,model.address];
    
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
